﻿using LpbPrj.Client.Data;
using Prism.Events;
using Prism.Services.Dialogs;

namespace LpbPrj.Client.ViewModels
{
    public class DeviceNoViewModel : DialogBaseViewModel, IDialogAware
    {
        public override void SaveDialog(ref DialogResult dialogResult)
        {
            GlobalData.Config.DeviceNo = _deviceNo;
            GlobalData.Config.SaveConfig(AppConfig.SavePath, true); 
            
            base.SaveDialog(ref dialogResult);
        }

        public DeviceNoViewModel(IEventAggregator eventAggregator, Prism.Regions.IRegionManager regionManager, Prism.Services.Dialogs.IDialogService dialogService)
            : base(eventAggregator, regionManager, dialogService)
        {
        }

        private string _deviceNo = GlobalData.Config.DeviceNo;
        public string DeviceNo { get => _deviceNo; set => SetProperty(ref _deviceNo, value); }


        private string _deviceNoConfirm;
        public string DeviceNoConfirm { get => _deviceNoConfirm; set => SetProperty(ref _deviceNoConfirm, value); }



    }
}
